/*
*Copyright (c) Nikhil Jain.
*Project ICARUS, communications and 
*artificial intelligence.
*/



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
 */
package javadrone.agent;

//~--- non-JDK imports --------------------------------------------------------

import simbad.sim.Agent;

//~--- JDK imports ------------------------------------------------------------

import com.sun.j3d.utils.geometry.Cylinder;

import javax.media.j3d.*;

import javax.vecmath.*;

/**
 *
 * @author Nikzzay
 */
public class ExtendedAgent extends Agent {
    public ExtendedAgent(Vector3d pos, String name) {
        super(pos, name);

        // dimensions
        this.height = 2f;
        this.radius = 4f / 2f;
        this.mass   = 2f;

        // Attached a kinematic
        kinematicModel = new ExtendedKinematicModel();
    }

    public void moveToPosition(double x, double y, double z) {
        Vector3d position = new Vector3d(x, y, z);

        resetPositionAt(position);
    }

    public final void setRotationalVelocity(Vector3d rv) {

        // because it's one of  the default kinematic fucntions we provide it  in the
        // agent's api.
        System.out.println("SETTING RV");

        if (kinematicModel instanceof ExtendedKinematicModel) {
            ((ExtendedKinematicModel) kinematicModel).setRotationalVelocity(rv);
        } else {
            System.out.println("Not an instance of EKM");
        }
    }

    /**
     * Sets translational velocity in meter per second.
     */
    public final void setTranslationalVelocity(Vector3d tv) {

        // because it's one of  the default kinematic fucntions we provide it  in the
        // agent's api.
        System.out.println("SETTING TV");

        if (kinematicModel instanceof ExtendedKinematicModel) {
            ((ExtendedKinematicModel) kinematicModel).setTranslationalVelocity(tv);
        } else {
            System.out.println("Not an instance of EKM");
        }
    }

    public Vector3d getRotationalVelocityVector() {
        if (kinematicModel instanceof ExtendedKinematicModel) {
            return ((ExtendedKinematicModel) kinematicModel).getRotationalVelocity();
        }

        return null;
    }

    public Vector3d getTranslationalVelocityVector() {
        if (kinematicModel instanceof ExtendedKinematicModel) {
            return ((ExtendedKinematicModel) kinematicModel).getTranslationalVelocity();
        }

        return null;
    }

    public Vector3d getCoordinates() {
        Vector3d    coords = new Vector3d();
        Transform3D t      = new Transform3D();

        getTranslationTransform(t);
        t.get(coords);

        return coords;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
